#!/user/bin/env python
#encoding: utf-8
 
from selenium import webdriver

browser = webdriver.Firefox()
browser.get("http://www.jd.com/")
browser.find_element_by_id("key").send_keys("phones")
browser.find_element_by_xpath("//button[@clstag='h|keycount|2015|03c']").click()
product = browser.find_elements_by_xpath("//div[@class='p-img']/a")
#product.click()
print(len(product))




#browser.find_element_by_id("su").click()
#browser.close()

# chrome_driver_path = r"C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe"
# browser = webdriver.Chrome(chrome_driver_path)
# browser.get("https://www.baidu.com")
# print(browser.title)
#    
# browser.find_element_by_id("kw").send_keys("gg")
# browser.find_element_by_id("su").click()
